<?php

use yii\grid\GridView;
use yii\widgets\LinkPager;
use common\helpers\Url;
use common\helpers\Html;

$this->title                   = '提现管理';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="box-tools">
                    <?= Html::a('返回日志', ['log'], ['class' => 'btn btn-primary']) ?>
                </div>
            </div>
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel'  => $searchModel,
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover'],
                    'columns'      => [
                        [
                            'class' => 'yii\grid\SerialColumn',
                        ],
                        [
                            'label'     => '申请用户',
                            'attribute' => 'member_id',
                            'value'     => 'manager.username',
                            'filter'    => FALSE,
                        ],
                        [
                            'attribute' => 'money',
                            'filter'    => FALSE,
                        ],
                        [
                            'attribute' => 'created_at',
                            'filter'    => FALSE,
                            'value'     => 'created_at',
                        ],
                        [
                            'header'   => "操作",
                            'class'    => 'yii\grid\ActionColumn',
                            'template' => '{status}',
                            'buttons'  => [
                                'status' => function ($url, $model, $key) {

                                    $res = Html::a('驳回',
                                        ['status', 'id' => $model->id, 'status' => -1], [
                                            'class' => 'btn btn-danger btn-sm',
                                        ]);
                                    $res .= Html::a('通过',
                                        ['status', 'id' => $model->id, 'status' => 1], [
                                            'class' => 'btn btn-success btn-sm',
                                        ]);

                                    return $res;
                                },
                            ],
                        ],
                    ],
                ]); ?>

            </div>

        </div>
    </div>
</div>